import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:xiongan_app_yy/pages/common/TextItemCard.dart';
import 'package:xiongan_app_yy/pages/common/BaseMaterialInfo.dart';
import 'package:xiongan_app_yy/provider/automounting_provider.dart';
import 'package:xiongan_app_yy/widgets/comm/left_icon_widget.dart';

class AutoMountingDDetailTwo extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _AutoMountingDDetailTwo();
  }
}

class _AutoMountingDDetailTwo extends State<AutoMountingDDetailTwo> {
  
  Map<String, dynamic> map = Map();
  List<Widget> childWidgets;

  @override
  Widget build(BuildContext context) {
    map=Provider.of<AutoMountingProvider>(context).detailData;
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        leading: LeftIconWidget(icon: Icons.chevron_left, isize: 36),
        backgroundColor: Color(0XFF00A5F1),
        title: Text(
          "自动上架详情",
          style: TextStyle(fontSize: 18),
        ),
        elevation: 0,
        centerTitle: true,
      ),
      body: Column(
        children: <Widget>[
          Expanded(
            child: Scrollbar(
              child: SingleChildScrollView(
                child: Column(
                  children: <Widget>[
                    TextItemCard(
                      name: "上架库区",
                      value: map['areaname'] ?? "暂无",
                    ),
                    TextItemCard(
                      name: "上架货架",
                      value: map['shelfname'] ?? "暂无",
                    ),
                    TextItemCard(
                      name: "上架货位",
                      value: map['tolocationcode'] ?? "暂无",
                    ),
                    Column(
                      children: <Widget>[
                        BaseMaterialInfo(
                          imgwid: Image.asset("assets/images/build.png",fit: BoxFit.fill),
                          options: {"materialname":"物资名称","materialcode":"实物ID","baseunitname":"基本单位","planquantity":"计划上架数"},
                          data: map,
                        ),
                      ],
                    )
                  ],
                ),
              ),
            ),
          ),
          Row(
            children: <Widget>[
              Expanded(
                child: FlatButton(
                  shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.all(Radius.circular(0))),
                  padding: EdgeInsets.all(15),
                  color: Color(0xffda732a),
                  child: Text(
                    "人工指定上架",
                    style: TextStyle(color: Colors.white),
                  ),
                  onPressed: () {
                    print("人工指定上架");
                    Navigator.of(context).pushNamed("/automounting_ddetail_one");
                  },
                ),
              ),
              Expanded(
                child: FlatButton(
                  shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.all(Radius.circular(0))),
                  padding: EdgeInsets.all(15),
                  color: Color(0xFF42AFF0),
                  child: Text(
                    "分配货位上架",
                    style: TextStyle(color: Colors.white),
                  ),
                  onPressed: () {
                    Navigator.of(context).pushNamed("/automounting_ddetail_two");
                  },
                ),
              )
            ],
          )
        ],
      ),
    );
  }
}
